PROJECT = "FairyCloud"
VERSION = "1.0.0"

_G.sys = require("sys")
_G.sysplus = require("sysplus")


-- 地图定位
require "gnss"

-- 启动时对rtc进行判断和初始化
local reason, slp_state = pm.lastReson()
wakeup_reason = reason
log.info("wakeup_reason", wakeup_reason)

-- 正常开机判断  reason 0正常开机 大于0是休眠唤醒
sys.taskInit(function()

    if wakeup_reason > 0 then
        pm.request(pm.IDLE)
        pm.power(pm.USB, true)
        --关闭飞行模式
        mobile.flymode(0, false)
        log.info("-------------------已经从深度休眠唤醒-------------------") 
    else           
        log.info("-------------------普通复位，开始运行-------------------")
    end

end)


sys.taskInit(function()

    while 1 do
        sys.wait(500)
    end
end)


sys.run()
